package my.wechat.rc.common;

import java.util.HashMap;
import java.util.Map;

public class MapUtil {

    public static Map<String, String> of(String key1, String value1) {
        return of(key1, value1, null, null);
    }

    public static Map<String, String> of(String key1, String value1, String key2, String value2) {
        return of(key1, value1, key2, value2, null, null);
    }

    public static Map<String, String> of(String key1, String value1, String key2, String value2, String key3, String value3) {
        return of(key1, value1, key2, value2, key3, value3, null, null);
    }

    public static Map<String, String> of(String key1, String value1, String key2, String value2, String key3, String value3, String key4, String value4) {
        return of(key1, value1, key2, value2, key3, value3, key4, value4, null, null);
    }

    public static Map<String, String> of(String key1, String value1, String key2, String value2, String key3, String value3, String key4, String value4, String key5, String value5) {
        Map<String, String> map = new HashMap<>();
        if (key1 != null && key1.length() > 0)
            map.put(key1, value1);
        if (key2 != null && key2.length() > 0)
            map.put(key2, value2);
        if (key3 != null && key3.length() > 0)
            map.put(key3, value3);
        if (key4 != null && key4.length() > 0)
            map.put(key4, value4);
        if (key5 != null && key5.length() > 0)
            map.put(key5, value5);
        return map;
    }
}